package file;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

// 字节流--写
public class Demo4 {
    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("test.txt")) {
            outputStream.write('h');
            outputStream.write('e');
            outputStream.write('l');
            outputStream.write('l');
            outputStream.write('o');

            String s = "hello java";
            outputStream.write(s.getBytes());

        }  catch (IOException e) {
            e.printStackTrace();
        }
    }
}
